package com.yunji.base.convert;

import com.google.common.base.Optional;
import com.yunji.base.cache.BaseCache;
import com.yunji.base.domain.ManagerDO;
import com.yunji.common.model.domain.SysUserDO;

import java.util.List;

/**
 * @author : peter-zhu
 * @date : 2024/12/11 18:11
 * @description : TODO
 **/
public class ManagerConvert {


    public static void convert(ManagerDO manager) {
        SysUserDO user = Optional.fromNullable(BaseCache.getUser(manager.getManagerId())).or(new SysUserDO());
        manager.setManagerPhone(user.getPhonenumber());
        manager.setManagerName(user.getNickName());
        manager.setBelongId(user.getBelongId());
    }

    public static void
    convert(List<ManagerDO> managers) {
        for (ManagerDO manager : managers) {
            convert(manager);
        }
    }
}
